Research
Security News
Threat Actor Exposes Playbook for Exploiting npm to Build Blockchain-Powered Botnets
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
is-text-path
Advanced tools
The is-text-path npm package is a simple utility to check if a given file path points to a text file. It helps in determining whether a file is a text file based on its extension.
Check if a path is a text file
This feature allows you to check if a given file path points to a text file. The function returns true if the file is a text file based on its extension, otherwise false.
const isTextPath = require('is-text-path');
const filePath = 'example.txt';
const result = isTextPath(filePath);
console.log(result); // true
The is-binary-path package checks if a given file path points to a binary file. It is similar to is-text-path but focuses on binary files instead of text files.
The file-type package detects the file type of a Buffer or Uint8Array. It is more comprehensive than is-text-path as it can identify a wide range of file types, not just text files.
The mime package is used to look up the MIME type of a file based on its extension. It provides more detailed information about the file type compared to is-text-path, which only checks if a file is a text file.
Check if a file path is a text file
$ npm install is-text-path
const isTextPath = require('is-text-path');
isTextPath('source/unicorn.txt');
//=> true
isTextPath('source/unicorn.png');
//=> false
text-extensions
- List of text file extensionsis-binary-path
- Check if a file path is a binary fileMIT © Sindre Sorhus
FAQs
Check if a file path is a text file
The npm package is-text-path receives a total of 5,759,241 weekly downloads. As such, is-text-path popularity was classified as popular.
We found that is-text-path demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
Security News
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
Security News
Research
A malicious npm package disguised as a WhatsApp client is exploiting authentication flows with a remote kill switch to exfiltrate data and destroy files.